<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-type" content="text/html; charset=utf-8"/>
	<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no"/>
	<meta name="apple-mobile-web-app-capable" content="yes"/>
	<title>Test Opener with ColorPalette</title>

	<link href="../themes/common/dijit/dijit.css" rel="stylesheet"/>
	<script type="text/javascript" src="../deviceTheme.js" data-dojo-config="mblThemeFiles: ['base','Overlay','Tooltip']"></script>
	<script type="text/javascript" src="../../../dojo/dojo.js" data-dojo-config="async: true, parseOnLoad: true"></script>

	<script language="JavaScript" type="text/javascript">
		require([
			"dojox/mobile",
			"dojox/mobile/compat",
			"dojox/mobile/parser",
			"dojox/mobile/Opener",
			"dijit/_base/manager", // dijit.byId
			"dijit/ColorPalette"
		]);

		function getColor1(node, v){
			if(v === true){ // Done clicked
				var w = dijit.byId("colorPalette");
				var color = w.get("value");
				if(color){
					node.value = color;
					node.style.backgroundColor = color;
					node.style.color =  "#" + ("0" +(255-parseInt(color.substr(1,2), 16)).toString(16)).slice(-2)
							+ ("0" + (255-parseInt(color.substr(3,2), 16)).toString(16)).slice(-2)
							+ ("0" + (255-parseInt(color.substr(5,2), 16)).toString(16)).slice(-2);
				}
			}
		}
	</script>

	<style>
		html, body{
			overflow: hidden;
		}
		.mblTooltip.mblOpener DIV[label='Cancel'] {
			display: none;
		}
	</style>
</head>
<body style="visibility:hidden;">
	<table cellspacing="20">
	<tr>
		<td style="text-align:right;">Color (Palette)</td>
		<td><input id="color1" readOnly value="transparent" style="background-color:transparent;"
			onclick="dijit.byId('colorPicker1').show(this, ['above-centered','below-centered','after','before'])"></td>
	</tr>
	</table>

	<div id="colorPicker1" data-dojo-type="dojox.mobile.Opener" data-dojo-props="onHide:getColor1">
		<h1 dojoType="dojox.mobile.Heading" label="Select a Color">
			<span dojoType="dojox.mobile.ToolBarButton" label="Done" class="mblColorBlue" style="position:absolute;width:45px;right:0;"
				onclick="dijit.byId('colorPicker1').hide(true)"></span>
			<span dojoType="dojox.mobile.ToolBarButton" label="Cancel" class="mblColorBlue" style="position:absolute;width:45px;left:0;"
				onclick="dijit.byId('colorPicker1').hide(false)"></span>
		</h1>
		<div id="colorPalette" dojoType='dijit.ColorPalette'></div>
	</div>
</body>
</html>
